const express = require('express');
const router = express.Router();
const mysql = require('mysql')
const db = require('../../sql/db')
const $sql = require('../../sql/sqlMap')

const connection = mysql.createConnection(db.mysql);
connection.connect();
const sql = $sql.admin.getStudentInfo;

router.post('/:id', (req, res, next) => {
    connection.query(sql, req.params.id, (err, result) => {
        if (err) {
            console.log(err)
            return
        }
        res.json({
            status: '0',
            msg: '获取id为 ' + req.params.id + ' 的学生信息',
            result: result
        })
    })
});

module.exports = router;
